import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.control.Button;
import javafx.geometry.Insets;
import javafx.event.EventHandler;
import javafx.event.ActionEvent;

class OKEventHandler implements EventHandler<ActionEvent> {
	public void handle(ActionEvent e){
		System.out.println("OK action trigged");
	}
}

class CancelEventHandler implements EventHandler<ActionEvent> {
	public void handle(ActionEvent e) {
		System.out.println("Cancel action trigged");
	}
}

public class Test extends Application {
	public void start(Stage stage) {
		Button btnOK=new Button("OK");
		OKEventHandler okHandler=new OKEventHandler();
		btnOK.setOnAction(okHandler);

		Button btnCancel=new Button("Cancel");
		CancelEventHandler cancelHandler=new CancelEventHandler();
		btnCancel.setOnAction(cancelHandler);

		HBox pane=new HBox();
		pane.setPadding(new Insets(10));
		pane.setSpacing(10);
		pane.getChildren().addAll(btnOK,btnCancel);

		Scene scene=new Scene(pane);

		stage.setTitle("EventHandler test");
		stage.setScene(scene);
		stage.show();
	}
}
